import { Link } from '@brillout/docpress'

In general, a Vike app is just a Node.js server, so we can use any Node.js Docker container.

## Build

If we build our app in Docker, we may stumble upon out-of-memory errors.

If we do, we check whether our Docker container has enough memory, and we may also need to set [Node.js' `--max-old-space-size`](https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes).

```json
// package.json
{
  "scripts": {
    "// We use Node.js' environment variable `NODE_OPTIONS` to increase memory size to 3GB": "",
    "build": "NODE_OPTIONS=--max-old-space-size=3072 npm run build:run",
    "build:run": "vite build"
  }
}
```
See also:
   - <Link href="/debug" />

## Dev

If we want to use Docker for development as well, we need to properly configure Docker for Vite's HMR port.

If we use Windows with [WSL](https://docs.microsoft.com/en-us/windows/wsl/), we need to configure [`chokidar`](https://github.com/paulmillr/chokidar) to use polling. (Vite uses `chokidar`.)

```json
// package.json
{
  "scripts": {
    "dev": "CHOKIDAR_USEPOLLING=true npm run server"
  }
}
```

Note that [it has been reported](https://discord.com/channels/815937377888632913/815937377888632916/910110118375489567) that [vite.config.js#server.watch.usePolling](https://vitejs.dev/config/#server-watch) doesn't work.

See also:
   - [StackOverflow - Chokidar isn't picking up file changes inside docker container](https://stackoverflow.com/questions/38318188/chokidar-isnt-picking-up-file-changes-inside-docker-container/69166925#69166925)
